package org.example.autofilearchiver.toolclass.DOCX;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.autofilearchiver.toolclass.ELSE.FindDataWithStringAndNumberObject;

import java.util.ArrayList;
import java.util.List;
//一个docx的模板文件，表示文件类别
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DocxFileTemplate {
    //唯一id
    private String id;
    //类别名字
    private String name;
    //存标识数据(唯一数据)
    private List<String> identifiers;
    //存操作tag数据和索引
    private List<FindDataWithStringAndNumberObject> FindDataWithStringAndNumberObjects;
    //为docx模板指定文件夹
    private String archivePath;
    public DocxFileTemplate copy() {
        List<String> copiedIdentifiers = new ArrayList<>();
        if (identifiers!= null) {
            copiedIdentifiers.addAll(identifiers);
        }

        List<FindDataWithStringAndNumberObject> copiedFindDataList = new ArrayList<>();
        if (FindDataWithStringAndNumberObjects!= null) {
            for (FindDataWithStringAndNumberObject obj : FindDataWithStringAndNumberObjects) {
                copiedFindDataList.add(obj.copy());
            }
        }

        return new DocxFileTemplate(
                id,
                name,
                copiedIdentifiers,
                copiedFindDataList,
                archivePath
        );
    }
}